<template>
<div>
  <el-tree
      :data="data"
      show-checkbox
      :node-key="id"
      :props="defaultProps"
      @check="getids"
  />
</div>

</template>

<script>
import axios from 'axios';
export default {
name: "depttree"
,
  data(){
    return{
      data:[],
      defaultProps: {
        children: "children",
        label: "name",
      },
    }
  },
  methods:{
    getaudit() {
      alert('dkfjdsl')
      //读取公司部门角色列表
      axios({ url: "/getcomanyuser", method: "get" }).then((res) => {
        this.data = res.data.list;
      });
    },
    getids(val1, status) {
      this.checkdvalues = [];
      let list = status["checkedNodes"];
      for (var i = 0; i < list.length; i++) {
        if (list[i]["type"] == 3) {
          this.checkdvalues.push(list[i]["id"]);

          alert(this.checkdvalues);
        }
      }
      this.$emit('setids',this.checkdvalues)
    },

    
  },
  mounted() {
  this.getaudit()

  }
}
</script>

<style scoped>

</style>